import conflg  from './db_table_conflg.js'
import myDB from "../src/index.js"


 let db  = await  myDB(conflg)

try {
    db.add({
        tableName: "user",
        data:[
            
            {
                id:"000001",
                name:"张五"
            }
        ]
    })
} catch(err){
    console.log(err)
}
   
db.updata({
    tableName: "user",
    handler:(value) => {
        value.name ="王五"
    },
    condition:(curValue , index) => {
      return curValue.name ==="张三"
    }
})
let q =await db.query({
    tableName: "user",
    condition:(curValue , index) => {
        return curValue.name ==="王五"
    }
})
console.log(q)

const store = await db.transaction({tableName: "user"});
db.delete({
    tableName: "user",
    condition:(curValue , index) => {
          return curValue.name ==="王五"
        }
})


